package com.encoder;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.utils.json.JsonUtils;
import com.vo.ChatMessageVO;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

/**
 * 消息编码
 */
public class ChatMessageEncoder implements Encoder.Text<ChatMessageVO> {
    @Override
    public String encode(ChatMessageVO object) throws EncodeException {
        String result = JsonUtils.getJsonString(object);
        return result;
    }

    @Override
    public void init(EndpointConfig endpointConfig) {

    }

    @Override
    public void destroy() {

    }


}
